package adapter;

import android.graphics.Color;
import android.support.annotation.Nullable;
import android.widget.TextView;
import base.BaseBean;
import bean.EvaluationBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dispatchapp.andlei.R;

import java.util.List;

/**
 * 评论标签适配器
 * @author Andlei
 * @date 2019/7/28.
 */
public class AssessMarkAdapter extends BaseQuickAdapter<EvaluationBean.TagInfoBean, BaseViewHolder> {
    private int type;
    public AssessMarkAdapter(int layoutResId, @Nullable List<EvaluationBean.TagInfoBean> data, int type) {
        super(layoutResId, data);
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, EvaluationBean.TagInfoBean item) {

        TextView textView = helper.getView(R.id.tv_assess_mark);
        textView.setText(item.getTag()+" ("+item.getCountX()+")");
        if(type == 1){
            textView.setBackgroundResource(R.drawable.shape_mark_bg);
            textView.setTextColor(Color.parseColor("#333333"));
        }else {
            textView.setBackgroundResource(R.drawable.shape_mark_bg_dark);
            textView.setTextColor(Color.parseColor("#ffffff"));
        }
    }
}
